//---------------------------------------------------------------------
// Author: jachymko
//
// Description: Initializes the tab expansion caches
//
// Creation Date: Jan 8, 2007
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Management.Automation;
using System.Text;


using Pscx.Commands.TabExpansion.Caches;

namespace Pscx.Commands.TabExpansion
{
    [Cmdlet(VerbsLifecycle.Start, PscxNouns.TabExpansion)]
    public class StartTabExpansionCommand : PscxCmdlet
    {
        private readonly List<TabExpansionCache> _caches = new List<TabExpansionCache>();

        public StartTabExpansionCommand()
        {
            _caches.Add(TypeNameCache.Instance);
            _caches.Add(WmiClassCache.Instance);
        }

        protected override void EndProcessing()
        {
            base.EndProcessing();

            foreach (TabExpansionCache cache in _caches)
            {
                cache.EnsureInitializedAsync();
            }
        }
    }
}
